/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */

//直接反转指针

struct ListNode* reverseList(struct ListNode* head){
    typedef struct ListNode ListNode;
    ListNode* tem;
    ListNode* pre=NULL;
    while(head){
        tem=head->next;
        head->next=pre;
        pre=head;
        head=tem;
    }
    return(pre);
}